import service from '@/axios/http'
import { TableIResponse } from '@/utils/Api'
import { PipePointInfoType } from '../gis/type'
import { facOutLedgerType } from './type'
export class FacOutLedgerApi {
  //查询设施出厂台账列表
  async GetfacOutLedgerFacList(params: any): Promise<TableIResponse<facOutLedgerType[]>> {
    const result = (await service.get('/api/patrol/facOutLedger/facList', {
      params
    })) as unknown as any
    return result
  }
  //查询设备出厂台账列表
  async GetfacOutLedgerDeviceList(params: any): Promise<TableIResponse<facOutLedgerType[]>> {
    const result = (await service.get('/api/patrol/facOutLedger/deviceList', {
      params
    })) as unknown as any
    return result
  }

  //删除出厂设备设施台账
  async DeletfacOutLedger(uuids: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/facOutLedger/${uuids}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增出厂设备设施台账
  async AddfacOutLedger(data: facOutLedgerType): Promise<boolean> {
    const result = (await service.post('/api/patrol/facOutLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //修改出厂设备设施台账
  async EditfacOutLedger(data: PipePointInfoType): Promise<boolean> {
    const result = (await service.put('/api/patrol/facOutLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
}
export default new FacOutLedgerApi()
